var active_menu=0;

function show_submenu(num)
{
   var sub_name = new String();
   
   if(num != active_menu && active_menu != 0)
   {
       hide_submenu(active_menu);
       active_menu = num;
       sub_name = "sub_menu"+num;
       document.getElementById(sub_name).style.display = "block";   
   }
   else if(num == active_menu)
   {
      hide_submenu(num);     
   }
   else
   {
       active_menu = num;
       sub_name = "sub_menu"+num;
       document.getElementById(sub_name).style.display = "block";         
   }
}

function hide_submenu(num)
{
   var sub_name = new String();
   active_menu = 0;
   sub_name = "sub_menu"+num;
   document.getElementById(sub_name).style.display = "none";   
}

function over_main(num)
{
   var sub_name = new String();
   sub_name = "menu"+num;
   document.getElementById(sub_name).style.background = "#575757";
   document.getElementById(sub_name).style.color = "Red";
}

function over_sub(num)
{
   var sub_name = new String();
   sub_name = "sub"+num;
   document.getElementById(sub_name).style.background = "#e1e1e1";  
   document.getElementById(sub_name).style.color = "Black";
}

function out_main(num)
{
   var sub_name = new String();
   sub_name = "menu"+num;
   document.getElementById(sub_name).style.background = "#e1e1e1";
   document.getElementById(sub_name).style.color = "Black";
}

function out_sub(num)
{
   var sub_name = new String();
   sub_name = "sub"+num;
   document.getElementById(sub_name).style.background = "#575757";  
   document.getElementById(sub_name).style.color = "White";
}

function click_sub(num, val)
{
   if(typeof(val)!="undefiled")window.parent.document.forms[0].dcase.value = val;
   window.parent.document.forms[0].cases.value = num;
   window.parent.document.forms[0].submit();
}
